<!-- /* Description for file.
 * 部门定制
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/departments
 * @since         ues
 * @version       V0.0.1
 * @modifiedby    张海杰2011年0625
 * @lastmodified  张海杰2011年0625
 */
 -->

<?php
echo $html->css ( 'tab' );
echo $javascript->link ( 'jquery' );
?>

<script type="text/javascript">
	function getDelStr() {
		var delArr = $("#DepartmentDeleteSomeForm :checkbox:checked");
		if(delArr.length==0)
		{
			alert("请选择你要删除的项!");
			return;
		}
		if(!confirm("确定删除?"))
		{
			return;
		}
		var str = "";
		for(var i=0;i<delArr.length;i++) {
			var del = delArr[i].value;
			str += del;
			str += "/";
		}
		$("#delStr").val(str);
		$("#DepartmentDeleteSomeForm").submit();
	}
	$(document).ready(function(){ 
		$("#checkedAll").click(function() {
		if ($(this).attr("checked") == true) { // 全选 
		$("input[name='checkbox_name']").each(function() { 
		$(this).attr("checked", true); 
		}); 
		} else { // 取消全选 
		$("input[name='checkbox_name']").each(function() { 
		$(this).attr("checked", false); 
		}); 
		} 
		}); 
	// 查询时局部刷新//	
		$("#btnajaxSearch").click(function(){
			$("#reloadpart").load(
					'<?php echo ROOT_WEB_PATH; ?>/departments/query/  #reloadpart',
					{ "name":$('#DepartmentName').val()},
					function(){
						$("#checkedAll").click(function() {
							if ($(this).attr("checked") == true) { // 全选 
							$("input[name='checkbox_name']").each(function() { 
							$(this).attr("checked", true); 
							}); 
							} else { // 取消全选 
							$("input[name='checkbox_name']").each(function() { 
							$(this).attr("checked", false); 
							}); 
							} 
							}); 
						});		
	});
});

</script>


<?php echo $form->create('Department',array('action'=>'deleteSome','type'=> 'post'));?>
<?php echo $form->hidden('delStr',array('name'=>'ids','id'=>'delStr'));?>

<div class="tabflex">
<fieldset><legend><?php __('Departments');?></legend>
<table width="100%" cellspacing="0" cellpadding="0" border="0"
	style="text-align: left">
	<tr>
		<td width="50"></td>
		
		<td width="100"><?php __('DepartmentsName');?>:</td>
		<td ><?php echo $form->text('name',array('class' => 'TextBoxL txtOut')); ?></td>
		<td width="40px">
		<a><?php echo $html->image('search.gif', array('alt' =>  __('Search', true),'border'=>'0','id'=>'btnajaxSearch' ));?> </a>		
		<!-- __('Search', true)查询--></td>
		<td width="40px">
		<?php echo $html->link( $html->image('add.gif', array('alt' =>  __('Add', true),'border'=>'0')), 
			'/departments/add/', null,null,array('escape'=>false));  ?> 	
		<!-- __('Add', true)增加--></td>
		<td width="40px">
		<a><?php echo $html->image('delete.gif', array('alt' =>  __('Delete', true),'border'=>'0','onclick'=>'getDelStr()'));?></a>
		</td>
		<!--  __('delete', true) 删除、提示 -->

	</tr>
</table>
</fieldset>
</div>

<!-- 部门列表 -->
<div id="reloadpart">				
<div id="nav1" style="width:97%">			
<table width="100%" cellpadding="0" cellspacing="0" class="tab1">
	<tr>
		<th width="70px"><?php echo $form->checkbox('',array('id'=>'checkedAll'));?></th>
		<th ><?php echo __('DepartmentsName');//部门名称?></th>
		<th ><?php echo __('DepartmentsManage');//部门负责人?></th>
		<th ><?php echo __('DepartmentsDescription');//部门描述?></th>
		<th ><?php echo __('OrgansName');//机构名称?></th>
		<th width="40px"><?php echo __('Operate');//修改?></th>
	</tr>
	<!-- Here's where we loop through our $Notes array, printing out post info --> 
	
	<?php 
	foreach ($initList as $data):
	?>
		<tr class=normal onmouseover='this.className= "over " '
			onmouseup='this.className= "over " '
			onmouseout='this.className= "normal " ' id="search">
		<td>
			<!-- 批量删除选择 -->				
			<?php echo $form->checkbox($data['Department']['id'], array('value' => $data['Department']['id'],'name'=>'checkbox_name'));?>
		</td>
		<td title="<?php echo $data['Department']['name']; ?>">
			<?php echo $data['Department']['name']; ?>
		</td>
		<td title="<?php echo $data['Department']['manage']; ?>">
			<?php echo $data['Department']['manage']; ?>
		</td>
		<td title="<?php echo $data['Department']['description']; ?>">
			<?php echo $data['Department']['description']; ?>
		</td>
		<td title="<?php echo $data['Organ']['name']; ?>">
			<?php echo $data['Organ']['name']; ?>
		</td>
		<td width="40px">
			<?php echo $html->link( $html->image('edit.gif', array('alt' =>  __('Edit', true),'border'=>'0')), 
			'/departments/edit/' . $data['Department']['id'], null,null,array('escape'=>false));  ?> 
				 <!-- __('Edit', true) 修改-->
		</td>
		</tr> 
	<?php endforeach; ?>
</table>
</div>
</div>

<!-- 部门列表 -->
<?php echo $form->end();?>




